import { baseURL,  } from '!/app.json'
import { request } from "./request";



/**
 * [getUserCourseByTitle 我的疗程
 * @param device_sn
 * @param title_id
 */
export const getUserCourseByTitle: any = (data) => {
    return request.post(`${baseURL}Weixin/UserCourse/getUserCourseByTitle`, { data });
};

/**
 * [getWuXueCourseApi 获取五穴同频小包
 * @param id 大包的title_id=>则获取小包信息
 * @param course_id 小包id
 */
export const getWuXueCourseApi: any = (data) => {
    return request.post(`${baseURL}Weixin/UserCourse/getWuXueCourse`, { data });
};

/**
 * [getWuXueCourseApi 获取五穴同频大包
 */
export const getWuXueDBCourseApi: any = () => {
    return request.post(`${baseURL}Weixin/UserCourse/getWuXueBaseCourse`,);
};

/**
 * [bindDevicesXueWei 设备绑定穴位
 * @param device_sn 设备编号
 * @param body_index 绑定部位下标
 * @param course_id 疗程小包编号
 * @param write_id 疗程id
 */
export const bindDevicesXueWei: any = (data) => {
    return request.post(`${baseURL}Weixin/DeviceBindBody/bind
`, { data });
};


/**
 * [unbindDevicesXueWei 设备解绑穴位
 * @param id  绑定穴位的记录编号
 */
export const unbindDevicesXueWei: any = (data) => {
    return request.post(`${baseURL}Weixin/DeviceBindBody/unbind
`, { data });
};


/**
 * [getDeviceBindBodyList 获取绑定穴位的列表
 * @param title_id 大包编号
 */
export const getDeviceBindBodyList: any = (data) => {
    return request.post(`${baseURL}Weixin/DeviceBindBody/getList
`, { data });
};


/**
 * [bindDoctorApi 绑定医生
 * @param doctor_phone
 */
export const bindDoctorApi: any = (data) => {
    return request.post(`${baseURL}Weixin/BindDoctor/bindDoctor`, { data });
};


/**
 * [getDoctorList 获取绑定家庭医生列表
 */
export const getDoctorListApi: any = () => {
    return request.get(`${baseURL}Weixin/BindDoctor/getDoctorList`,);
};



/**
 * [checkDeviceWriteApi 获取疗程检测是否写入成功
 * @param json [{"course_id":"168","device_id":"262392"},{"course_id":"169","device_id":"262392"}]
 * @title_id 大包id
 */
export const checkDeviceWriteApi: any = (data) => {
    return request.post(`${baseURL}Weixin/DeviceBindBody/deviceWriteCheck
`, { data });
};



/**
 * [checkDeviceWriteApi 切换新大包疗程获取写入对应设备的小包编号
 * @param title_id 大包id
 */
export const switchGetCourseId: any = (data) => {
    return request.post(`${baseURL}Weixin/UserCourse/getCourseId
`, { data });
};

/**
 * [getUserUseTitleIdApi 获取当前用户使用大包id
 */
export const getUserUseTitleIdApi: any = () => {
    return request.post(`${baseURL}Weixin/UserUseFiveCourse/getUseTitleId`);
};


/**
 * [saveUserSelectTitleId 保存当前用户使用大包id
 * @params title_id 大包id
 */

export const saveUserSelectTitleId: any = (data) => {
    return request.post(`${baseURL}Weixin/UserUseFiveCourse/save`, { data });
};



/**
 * [checkCourseByDevices 检测有无可写入小包数据
 * @params title_id 大包id
 * @params device_sn_str [设备sn编号]
 */

export const checkCourseByDevices: any = (data) => {
    return request.post(`${baseURL}Weixin/UserUseFiveCourse/checkCourse`, { data });
};

/**
 * [updateBindCourseIdApi 切换疗程后更新设备绑定疗程id
 * @params device_id 设备id
 * @params course_id 疗程id
 */

export const updateBindCourseIdApi: any = (data) => {
    return request.post(`${baseURL}Weixin/DeviceBindBody/updateBindCourseId`, { data });
};


/**
 * [checkStartCourseState 检测设备需要切换疗程还是写入疗程
 * @params device_sn 设备编号
 */

export const checkStartCourseStateApi: any = (data) => {
    return request.post(`${baseURL}Weixin/UserCourse/checkStartCourse`, { data });
};
